import java.awt.Image;
import java.awt.Rectangle;
import javax.swing.JPanel;


public class RangeWeapon extends JPanel 
{
		Rectangle rwBox;
	   //creates the placement for the shape
	   public double x2, y2, y3;
	   public double m, xx, yy;;
	   
	   boolean firing;
	   
	   public RangeWeapon()
	   {
		   rwBox = new Rectangle(((int)xx)-1,((int)yy)+1,3,3);
		   
	   }
	   
	   public Rectangle getBounds() 
	   {
	       return rwBox;
	   }
	   
	   public void changeBounds(int x,int y)
	   {
	      rwBox = new Rectangle(x,y,3,3);
	   }
	   
	   public void setX(int x)
	   {
		   x2= x;
	   }
	   
	   public void setY(int y)
	   {
		   y2= Math.abs(y-600);
		   y3=y;
	   }
	   
	   public void fireEquation(int x1, int y1)
	   {
		   if (x2>x1)
			   m= -(y2-Math.abs(y1-600))/(x2-x1);
		   else
			   m= (y2-Math.abs(y1-600))/(x2-x1);  
		   
	   }
	   public double fireSlope()
	   {
		   return m;
	   }
	   
	   public double fireX()
	   {
		   double x = 10*Math.cos(Math.atan(m));
		   return x;
		   }
	   
	   public double fireY()
	   {
		   double y = 10*Math.sin(Math.atan(m));
		   
		   return y;
	   }
	   
	   public double firingX(int x1)
	   {
		   xx = x1*Math.cos(Math.atan(m));
		   return xx;
	   }
	   
	   public double firingY(int x1)
	   {
		   yy = x1*Math.sin(Math.atan(m));
		   return yy;
	   }
	   public void setFiring(boolean f)
	   {
		   if(f==true)
			   firing=true;
		   else
			   firing=false;
	   }
	   
	   public boolean firing()
	   {
		   return firing;
	   }
	   
	   public boolean sideOfPlayer(int x)
	   {
		   if(x2>x)
			   return true;
		   else
			   return false;
		   
	   }
	   
	   public void fire()
	   {
		   
	   }
	   

}
